Avoid some clang compiler warnings
authorMatthias Clasen <mclasen@redhat.com>
Sun, 22 Mar 2015 19:12:30 +0000 (15:12 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 22 Mar 2015 19:13:32 +0000 (15:13 -0400)
Avoid some compiler warnings from clang in deprecated code.
Most of these are around our habit of using -1 as an 'unset'
value for enumerations.

gtk/deprecated/gtkfontsel.c
gtk/deprecated/gtkhandlebox.c
gtk/deprecated/gtkiconfactory.c
gtk/deprecated/gtkstock.c

index d7b5154af950188b2406ff419f0c4445867328b0..7812e75b287e6cc3a2f879f967001ee88831730e 100644 (file)
@@ -1111,7 +1111,7 @@ gtk_font_selection_size_activate (GtkWidget   *w,
   const gchar *text;
 
   text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
-  new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
+  new_size = (int) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
 
   if (priv->size != new_size)
     gtk_font_selection_set_size (fontsel, new_size);
@@ -1130,7 +1130,7 @@ gtk_font_selection_size_focus_out (GtkWidget     *w,
   const gchar *text;
 
   text = gtk_entry_get_text (GTK_ENTRY (priv->size_entry));
-  new_size = MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
+  new_size = (int) MAX (0.1, atof (text) * PANGO_SCALE + 0.5);
 
   gtk_font_selection_set_size (fontsel, new_size);
 
index 3d2046b16daf04c860cd7b7c6aa792b2e21a84cd..76f6e6107bd6126098a56090c2518066ce39f306 100644 (file)
@@ -77,7 +77,7 @@ struct _GtkHandleBoxPrivate
 {
   /* Properties */
   GtkPositionType handle_position;
-  GtkPositionType snap_edge;
+  gint snap_edge;
   GtkShadowType   shadow_type;
   gboolean        child_detached;
   /* Properties */
@@ -1051,7 +1051,7 @@ gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box)
 {
   g_return_val_if_fail (GTK_IS_HANDLE_BOX (handle_box), (GtkPositionType)-1);
 
-  return handle_box->priv->snap_edge;
+  return (GtkPositionType)handle_box->priv->snap_edge;
 }
 
 /**
index 56a4e5ecd7f29ad1d11d05d036635e9238062e94..a23aecfc27043d108fe50707981259548f671b08 100644 (file)
@@ -2945,17 +2945,17 @@ gtk_icon_factory_buildable_custom_tag_end (GtkBuildable *buildable,
            }
          if (source_data->icon_name)
            gtk_icon_source_set_icon_name (icon_source, source_data->icon_name);
-         if (source_data->size != -1)
+         if ((gint)source_data->size != -1)
             {
               gtk_icon_source_set_size (icon_source, source_data->size);
               gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
             }
-         if (source_data->direction != -1)
+         if ((gint)source_data->direction != -1)
             {
               gtk_icon_source_set_direction (icon_source, source_data->direction);
               gtk_icon_source_set_direction_wildcarded (icon_source, FALSE);
             }
-         if (source_data->state != -1)
+         if ((gint)source_data->state != -1)
             {
               gtk_icon_source_set_state (icon_source, source_data->state);
               gtk_icon_source_set_state_wildcarded (icon_source, FALSE);
index 3415f6e24c827aac7fe5b4595386e78899e6c51e..71f3c69bbfcfb16674560e4c0cfb887f13b24f26 100644 (file)
@@ -95,7 +95,7 @@ real_add (const GtkStockItem *items,
       gpointer old_key, old_value;
       const GtkStockItem *item = &items[i];
 
-      if (replace_primary && item->modifier == PRIMARY_MODIFIER)
+      if (replace_primary && (guint)item->modifier == PRIMARY_MODIFIER)
         {
           item = gtk_stock_item_copy (item);
           ((GtkStockItem *)item)->modifier = (NON_STATIC_MASK |